home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Extensions / Imaging / PIL / ImageSequence.py < prev    next >
Encoding:
Python Source  |  2000-06-23  |  660 b   |  32 lines

  1. #
  2. # The Python Imaging Library.
  3. # $Id: ImageSequence.py,v 1.1.1.1 1998/08/18 13:07:57 sjoerd Exp $
  4. #
  5. # some sequence support stuff
  6. #
  7. # history:
  8. #    97-02-20 fl    Created
  9. #
  10. # Copyright (c) Secret Labs AB 1997.
  11. # Copyright (c) Fredrik Lundh 1997.
  12. #
  13. # See the README file for information on usage and redistribution.
  14. #
  15.  
  16. class Iterator:
  17.  
  18.     """Sequence iterator (use with the for-statement)"""
  19.  
  20.     def __init__(self, im):
  21.     if not hasattr(im, "seek"):
  22.         raise AttributeError, "im must have seek method"
  23.     self.im = im
  24.  
  25.     def __getitem__(self, ix):
  26.     try:
  27.         if ix:
  28.         self.im.seek(ix)
  29.         return self.im
  30.     except EOFError:
  31.         raise IndexError # end of sequence
  32.